package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//数据权限可选择数据类型
@Getter
@AllArgsConstructor
public enum DataScopeCustomizeTypeEnum {

    DEPT(1,"部门"),
    USER(2,"用户"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, DataScopeCustomizeTypeEnum> VALUES = new HashMap<>();

    static {
        for (final DataScopeCustomizeTypeEnum dataScopeCustomizeTypeEnum : DataScopeCustomizeTypeEnum.values()) {
            DataScopeCustomizeTypeEnum.VALUES.put(dataScopeCustomizeTypeEnum.getValue(), dataScopeCustomizeTypeEnum);
        }
    }

    @JsonCreator
    public static DataScopeCustomizeTypeEnum getByValue(Integer value) {
        return DataScopeCustomizeTypeEnum.VALUES.get(value);
    }
}
